#if !defined (APPLICATION_H_CA52C692_38BA_4E31_9A2C_89B6B36FE073_)
#define APPLICATION_H_CA52C692_38BA_4E31_9A2C_89B6B36FE073_

#pragma once                    // in case the compiler supports it

#ifndef _UNICODE
    #error This application must be compiled to support Unicode.
#endif

#ifdef _WIN32
    #if defined(_MSC_VER) && _MSC_VER < 1800
        #error This application needs to be compiled with Visual Studio 2013 or newer.
    #endif

    #ifndef _WIN64
        #error This application must be compiled to support 64-bit.
    #endif
#endif

#ifdef __cplusplus
    #error This application must be compiled as C.
#endif

// standard definitions
#define STRICT                                                  // enable strict type-checking of Windows handles
#define WIN32_LEAN_AND_MEAN                                     // allow the exclusion of uncommon features
#define NOSERVICE                                               // allow the exclusion of uncommon features
#define NOMCX                                                   // allow the exclusion of uncommon features
#define NOIME                                                   // allow the exclusion of uncommon features
#define NOSOUND                                                 // allow the exclusion of uncommon features
#define NOKANJI                                                 // allow the exclusion of uncommon features
#define NOPROXYSTUB                                             // allow the exclusion of uncommon features
#define NOIMAGE                                                 // allow the exclusion of uncommon features
#define NOTAPE                                                  // allow the exclusion of uncommon features
#define WINVER                                          0x0501  // allow the use of Windows XP specific features
#define _WIN32_WINNT                                    0x0501  // allow the use of Windows XP specific features
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES         1       // use the new secure functions in the CRT
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT   1       // use the new secure functions in the CRT

// standard includes
#include <windows.h>            // fundamental Windows header file
#include <windowsx.h>           // useful Windows programming extensions
#include <commctrl.h>           // common controls for windows and dialogs
#include <tchar.h>              // generic text character mapping
#include <string.h>             // string manipulation routines
#include <stdlib.h>             // standard libraries
#include <stdio.h>              // standard input/output routines

// global includes
#include "..\Resource\Resource.h"  // resource numeric identifiers

#ifndef __cplusplus
    // ensure we have a boolean type in C, we do this because we want "true"
    // "false" to an actual type instead of a define in <stdbool.h>
    typedef enum {false=FALSE, true=TRUE} bool;
#endif

// borrow an idea from C++ boost to have a triple state boolean
typedef enum {no=FALSE, yes=TRUE, maybe=-1} tribool;

// portable type definitions
typedef TCHAR alpha;
typedef size_t memsize;
typedef LPTSTR cstring;

typedef __int8 int8;
typedef __int16 int16;
typedef __int32 int32;
typedef __int64 int64;

typedef unsigned __int8 uint8;
typedef unsigned __int16 uint16;
typedef unsigned __int32 uint32;
typedef unsigned __int64 uint64;

typedef BYTE byte;

typedef float float32;
typedef long double float64;

// convenience macros
#define MIN(x, y)               (((x) < (y)) ? (x) : (y))
#define MAX(x, y)               (((x) > (y)) ? (x) : (y))

// macros for using c-style strings
#define COUNT(buffer)              (_countof(buffer))
#define MATCH(one, two)            (_tcscmp(one, two) == 0)
#define NMATCH(one, two, count)    (_tcsncmp(one, two, count) == 0)
#define IMATCH(one, two)           (_tcsicmp(one, two) == 0)
#define NIMATCH(one, two, count)   (_tcsnicmp(one, two, count) == 0)
#define FORMAT(dest, format, ...)  (_stprintf_s((LPTSTR)dest, _countof(dest), format, __VA_ARGS__) != -1)
#define CONCAT(dest, src)          (_tcscat_s((LPTSTR)dest, _countof(dest), src) == 0)
#define COPY(dest, src)            (_tcscpy_s((LPTSTR)dest, _countof(dest), src) == 0)
#define NCOPY(dest, src, count)    (_tcsncpy_s((LPTSTR)dest, _countof(dest), src, count) == 0)

// application constants
#define APP_NAME        _T("Oatmeal")                                        // name of the application
#define MAIN_CLASS_NAME _T("MAIN_9826C328_598D_4C2E_85D4_0FF8E0310366")      // unique class name of the main window
#define COMPANY_NAME    _T("Wizkit")                                         // company responsible for this software
#define MAX_LOADSTRING  256                                                  // max buffer size for simple string data
#define SINGLE_INSTANCE _T("MUTEX_6BFB33CD_0FC9_4A48_822D_95B81D6B7330")     // single instance mutex identifier

// application configurations and defaults
#define CONFIG_SINGLE_INSTANCE     TRUE          // do we allow single or multiple instances of the app

#endif  // APPLICATION_H